package net.comic.services

import net.comic.entities.*
import net.comic.controllers.*


class CommentService {
    boolean transactional = true


    def commentComic(params, id, userLogged) {
    	println "comment service " + userLogged
    	def comment = new Comment(params)
    	comment.commentedBy = userLogged
        if (!comment?.hasErrors()) {
        	println "grba"
        	def comic = Comic.get(id)
        	println "comic  " + comic + " id " + comic.id
        	comic.addToComments(comment)
            return [result:true, instance:comic] 
        }
    	
        return [result:false, instance:comment]
    }
}
